﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>表单模板版本管理</title>
    <link href="../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" />
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <script type="text/javascript" src="../../Comm/JScript.js"></script>
    <script type="text/javascript"
            src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript"
            src="../../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../../Scripts/QueryString.js"></script>
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>
    <link href="../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
    <link href="../../Style/skin/css/Default.css" rel="stylesheet" />
    <script src="../Admin.js"></script>
    <base target="_self" />

    <script type="text/javascript">

        var frmID = GetQueryString("FrmID");

        //页面启动函数.
        $(function () {

            var ens = new Entities("BP.Sys.MapDataVers");
            ens.Retrieve("FrmID", frmID);

            var html = "";
            html += "<table class='table'>";
            html += "<tr>";
            html += "<th>版本号</th>";
            html += "<th>操作</th>";
            html += "<th>状态</th>";

            html += "<th>数据行数</th>";
            html += "<th>字段数</th>";
            html += "<th>附件数</th>";
            html += "<th>从表数</th>";
            html += "<th>逻辑数</th>";


            html += "<th>创建人</th>";
            html += "<th>日期</th>";

          /*  html += "<th>操作</th>";*/
            html += "</tr>";

            for (var i = 0; i < ens.length; i++) {
                var item = ens[i];

                html += "<tr>";

                html += "<td>" + item.Ver + ".0</td>";

                if (item.IsRel == 0) {
                    html += "<td><a href=\"javascript:Del('" + item.MyPK + "')\"><img src='../../Img/Btn/Delete.gif' /></a></td>";
                    html += "<td><a href=\"javascript:SetCurrentVer('" + item.MyPK + "')\">设置主版本</a></td>";
                } else {
                    html += "<td>--</td>";
                    html += "<td>主版本</td>";
                }

                html += "<td>" + item.RowNumExt + "</td>";
                html += "<td>" + item.AttrsNum + "</td>";
                html += "<td>" + item.AthsNum + "</td>";
                html += "<td>" + item.DtlsNum + "</td>";
                html += "<td>" + item.ExtsNum + "</td>";

                html += "<td>" + item.RecName + "</td>";
                html += "<td>" + item.RDT + "</td>";

                //html += "<td><a class='cc-btn-tab' href='javaScript:void(0)' onclick='changeOrOpenTab(\""
                //    + item.Name + "\",\"" + item.No + "\")'>编辑</a></td>";
                // html += "<td><a class='cc-btn-tab' href='Imp.htm?FK_Flow=" + item.No + "'>导入</a>&nbsp&nbsp<a class='cc-btn-tab' href='Exp.htm?FK_Flow=" + item.No + "'>导出</a></td>";
                html += "</tr>";
            }
            html += "</table>";
            $("#docs").html(html);
        });

        //已知URL,在右侧打开页面
        function OpenWindowRight(url, title) {
            if (top.layui.index) {
                top.layui.index.openTabsPage(url, title)
            } else {
                window.open(url)
            }
        }


        function changeOrOpenTab(flowName, flowNo) {
            //"&UserNo=" + WebUser.No + "&Token=" + webUser.Token + "&Flow_V=1", node.iconCls
            var webUser = new WebUser();
            var url = "../CCBPMDesigner/Designer.htm?FK_Flow=" + flowNo;

            url += "&UserNo=" + webUser.No + "&Token=" + webUser.Token + "&Flow_V=1&OrgNo=" + webUser.OrgNo;
            if (top.layui.index) {
                url = "../FlowDesigner/Designer.htm?FK_Flow=" + flowNo;

                url += "&UserNo=" + webUser.No + "&Token=" + webUser.Token + "&Flow_V=1&OrgNo=" + webUser.OrgNo;
                top.layui.index.openTabsPage(url, flowNo + "." + flowName);
            } else {
                window.parent.parent.addTab(flowNo, flowNo + "." + flowName, url,
                    "icon-flow1");
            }
        }

        function Del(no) {

            if (window.confirm('您确定要删除吗？') == false)
                return;
            var en = new Entity("BP.Sys.MapDataVer", no);
            en.Delete();
            Reload();
        }
        //创建新版本.
        function NewVer() {

            if (window.confirm('您确定要创建新版本吗？') == false)
                return;

            var en = new Entity("BP.Sys.MapData", frmID);
            var data = en.DoMethodReturnString("CreateMapDataVer");
            alert(data);

            Reload();
        }
        function SetCurrentVer(no) {

            if (window.confirm('您确定要设置为当前版本？') == false)
                return;
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
            handler.AddPara("MyPK", no);
            var data = handler.DoMethodReturnString("MapDataVer_SetMainVer");
            //var en = new Entity("BP.Sys.MapDataVer", no);
            //var data = en.DoMethodReturnString("SetMainVer");
            alert(data);
            Reload();

        }

        function More() {

            var url = "https://blog.csdn.net/ccflow/article/details/100854967";
            WinOpen(url);
        }

    </script>
    <style type="text/css">
        caption {
            text-align: left;
            font-family: 'Microsoft YaHei';
            font-weight: bolder;
            border-bottom: none;
            margin-bottom: 10px;
        }
    </style>
</head>
<body>
    <div class="container-full">

        <div id="titleH4" class="attrnode-bar-header">
            <span class="pull-right">
                <button id="Btn_New" class="cc-btn-tab btn-new" onclick="NewVer();">新建版本</button>
                <button id="Btn_Help" class="cc-btn-tab btn-hlep" onclick="More();">帮助?</button>
            </span>
            <strong>版本管理 </strong>
        </div>
        <div id="docs"></div>

        <div style="position:relative;" id="Msg"></div>
    </div>
</body>
</html>
